﻿// JScript File
function OnClickDate(sender, date) {
		//sender, date
		//alert(date.format(GLOBAL_CALENDAR_DATE_FORMAT));
		
		var url  = "../Commons/MemorandumForm.aspx";
	        var prm  = "?MEMO_DATE=" + date.format(GLOBAL_CALENDAR_DATE_FORMAT);
	        url += prm;
	        //alert(url);
		window.open(url,'MemorandumForm','scrollbars,resizable,height=460,width=500')
		//sender.getDateCell(date.format(GLOBAL_CALENDAR_DATE_FORMAT)).style.background='#ffff00';
		
}

function OnChangeMonth(sender, oldDate, newDate) {
    _GLOBAL_CALENDAR_OBJ = sender;

    redrawCalendar(sender);
}

var _GLOBAL_CALENDAR_OBJ = null;

function OnClickHeader(sender, date) {
    _GLOBAL_CALENDAR_OBJ = sender;
    
    redrawCalendar(sender);
}

function OnClickWeek(sender, week) {
    sender.createCalendar();
}

function redrawCalendar(obj) {
    // Object or Calendar ID
    _GLOBAL_CALENDAR_OBJ = (typeof(obj)=='object')?obj:parseCalendar(obj);
    if( obj!=null ) obj.createCalendar();
	CommonAjaxUtils.FindByMemoInfo(obj.date.format(GLOBAL_CALENDAR_DATE_FORMAT), callBackMemoInfoResult);
}

function callBackMemoInfoResult(response) {    
    try {                                            
        var dataList = response.value;

        for(var i=0; dataList!=null && i<dataList.length; i++) {
            var dataBean = dataList[i];

            var cellObj = _GLOBAL_CALENDAR_OBJ.getDateCell(dataBean.MemoDate.format(GLOBAL_CALENDAR_DATE_FORMAT));

            if( cellObj!=null ) {
                cellObj.style.background = '#ffff00';
            }
        }
    }
    catch(e) {
    }
}